﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Citrix.XaAdminMobile.Model
{
    /// <summary>
    /// Model interface for controlling which XenApp server the application will talk to
    /// perform its administration actions.
    /// </summary>
    internal interface IServerConfigModel
    {
        /// <summary>
        /// Saves the supplied historical list of server names to persistent storage. Null/empty
        /// server names are ignored and any localhost entries are ignored.
        /// </summary>
        /// <param name="servers">The list of server names to save.</param>
        void SetServerHistory(List<string> servers);

        /// <summary>
        /// Sets and saves to persistent storage the name of the XenApp server this app should
        /// connect to for performing its admin tasks.
        /// 
        /// If you set a null/empty name then we set the server name to localhost instead.
        /// </summary>
        /// <param name="serverName">XenApp server name.</param>
        void SetServerName(string serverName);

        /// <summary>
        /// The name of the currently configured server.
        /// </summary>
        string ServerName { get; }

        /// <summary>
        /// The history of previously used XenApp server names.
        /// </summary>
        List<string> ServerHistory { get; }

        /// <summary>
        /// Makes an XenApp admin query to the supplied server to see if it is successful in
        /// order to determine whether it is a valid server to use.
        /// </summary>
        /// <param name="serverName">The server name to test.</param>
        /// <param name="error">On an error this will contain an error message.</param>
        /// <returns>True if successful, false if not.</returns>
        bool TestServerName(string serverName, out string error);
    }
}
